package com.xiaoyu.lingdian.service.impl;

import java.util.Map;
import java.util.List;
import java.util.HashMap;
import com.xiaoyu.lingdian.core.mybatis.page.Page;
import com.xiaoyu.lingdian.core.mybatis.page.PageRequest;
import com.xiaoyu.lingdian.service.CoreTaobaoPicService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.xiaoyu.lingdian.core.mybatis.dao.MyBatisDAO;
import com.xiaoyu.lingdian.entity.CoreTaobaoPic;

/**
* 淘宝表
*/
@Service("coreTaobaoPicService")
public class CoreTaobaoPicServiceImpl implements CoreTaobaoPicService {

	@Autowired
	private MyBatisDAO myBatisDAO;

	@Override
	public boolean insertCoreTaobaoPic(CoreTaobaoPic coreTaobaoPic) {
		myBatisDAO.insert(coreTaobaoPic);
		return true;
	}

	@Override
	public boolean updateCoreTaobaoPic(CoreTaobaoPic coreTaobaoPic) {
		myBatisDAO.update(coreTaobaoPic);
		return true;
	}

	@Override
	public boolean deleteCoreTaobaoPic(CoreTaobaoPic coreTaobaoPic) {
		myBatisDAO.delete(coreTaobaoPic);
		return true;
	}

	private static final String DELETEBATCH_CORETAOBAOPIC_BY_IDS="deleteBatchCoreTaobaoPicByIds";

	@Override
	public boolean deleteBatchByIds(List<String> list ) {
		Map<String, Object> hashMap = new HashMap<String, Object>();
		hashMap.put("list", list);
		myBatisDAO.delete(DELETEBATCH_CORETAOBAOPIC_BY_IDS,hashMap);
		return true;
	}

	@Override
	public CoreTaobaoPic getCoreTaobaoPic(CoreTaobaoPic coreTaobaoPic) {
		return (CoreTaobaoPic) myBatisDAO.findForObject(coreTaobaoPic);
	}

	private static final String FIND_CORETAOBAOPIC_FOR_LISTS="findCoreTaobaoPicForLists";

	@SuppressWarnings("unchecked")
	@Override
	public List<CoreTaobaoPic> findCoreTaobaoPicList() {
		return myBatisDAO.findForList(FIND_CORETAOBAOPIC_FOR_LISTS, null);
	}

	private static final String FIND_CORETAOBAOPIC_FOR_PAGES="findCoreTaobaoPicForPages";

	@SuppressWarnings("unchecked")
	@Override
	public Page<CoreTaobaoPic> findCoreTaobaoPicPage(String crtpcAccount, int pageNum, int pageSize) {
		Map<String, Object> hashMap = new HashMap<String, Object>();
		hashMap.put("crtpcAccount", crtpcAccount);
		return myBatisDAO.findForPage(FIND_CORETAOBAOPIC_FOR_PAGES, new PageRequest(pageNum, pageSize, hashMap));
	}

//<=================定制内容开始==============
//==================定制内容结束==============>

}